Repository navigation
Check PHP 7.4 compatibility in PHPCS with PHPCompatibilityWP (Phase A2) - #151
Merged
Merged
Conversation
The plugin declares Requires PHP: 7.4, but only the runtime matrix's one PHP 7.4 cell would catch PHP 8-only syntax. PHPCompatibilityWP now runs in composer lint:php with testVersion 7.4-. It uses the 10.0 alpha line: the stable 9.3.5 knows nothing past PHP 7.4 and passed a probe using match and ?-> without a word. Current code passes clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KbVuMPN7YTcV27vwsG3LZ2
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #151 +/- ##
=========================================
Coverage 88.28% 88.28%
Complexity 22 22
=========================================
Files 61 61
Lines 7290 7290
Branches 690 690
=========================================
Hits 6436 6436
Misses 291 291
Partials 563 563 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase A, ticket 2 of
docs/planning/refactor-and-standards-memo.md.The plugin declares
Requires PHP: 7.4. Until now, PHP 8-only syntax would only be caught by the runtime matrix's single PHP 7.4 cell. That's late and coarse. This PR addsPHPCompatibilityWPtophpcs.xml.distwithtestVersion 7.4-, socomposer lint:phpcatches it up front, and CI already runs that command.Why the alpha versions. I tried the stable
phpcompatibility-wp2.1.8 /php-compatibility9.3.5 first. It ran a probe file containingmatchand?->and reported nothing, because 9.3.5 knows nothing past PHP 7.4. The 10.0 alpha line (php-compatibility10.0.0-alpha2,phpcompatibility-wp3.0.0-alpha2,-paragonie2.0.0-alpha2) flags both. It's the line the WordPress tooling ecosystem uses for PHP 8 checks.The
@alphaflags are on these dev-only packages only. The release ZIP installs--no-devand is unaffected.str_contains()and the other functions WordPress polyfills are allowed, as PHPCompatibilityWP intends.Validation
composer lint:php: passes on current code. All 14 plugin PHP files are compatible with PHP 7.4.includes/, the repo ruleset reports:PHPCompatibility.Operators.NewOperators.t_nullsafe_object_operatorFound;PHPCompatibility.Keywords.NewKeywords.t_matchFound.Checklist
composer lint:phpstep🤖 Generated with Claude Code
https://claude.ai/code/session_01KbVuMPN7YTcV27vwsG3LZ2
Generated by Claude Code